package csel.controller.commands;

import csel.model.*;
import csel.view.*;

public class LoadCommand implements GameCommand
{
	private Model model;
	private Viewport viewport;
	private String fileName;
	
	//constructs a new load command
	public LoadCommand(Model model, Viewport viewport)
	{
		this.model = model;
		this.viewport = viewport;
		this.fileName = viewport.promptOpenDialog();
	}

	//checks if the filename is valid and calls the load command
	public void execute()
	{
		if (fileName != null)
		{
			model.load(fileName);
		}
		System.out.println("[MODEL] the Load command has been called");
	}

}